package com.huazi.eduservice.controller;

import com.huazi.commonutils.CommentResult;

import com.huazi.commonutils.PropertyInfo;
import io.swagger.annotations.ApiParam;
import org.springframework.web.bind.annotation.*;

/**
 * @author shkstart
 * @create 2021-03-14 16:30
 */
@RestController
//@CrossOrigin//解决跨域
@RequestMapping("/eduservice/user")
public class EduLoginController {

    @PostMapping("/login")
    public CommentResult login(){
        System.out.println("--login");
        return CommentResult.getOK().data("token","admin");
    }
    @GetMapping("/info")
    public CommentResult info(){
        System.out.println("--info");
        return CommentResult.getOK()
                .data("roles","[admin]")
                .data("name","admin")
                .data("avatar","https://wpimg.wallstcn.com/f778738c-e4f8-4870-b634-56703b4acafe.gif");
    }
    @PostMapping("/logout")
    public CommentResult logout(){
        return CommentResult.getOK().data("token","admin");
    }
    @GetMapping("/local/{local}")
    public CommentResult local(@PathVariable String local){
        return CommentResult.getOK().data("localInfo", PropertyInfo.getLocal(local));
    }
}
